<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="author" content="林镭特">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
        .box{
            width: 100px;
            height: 100px;
          background-color: #ccc;
        }

        .fade-leave,
        .fade-enter-to{
            height: 100px;
            background-color: #ccc;
        }
        .fade-leave-to,
        .fade-enter{
            height: 0px;
            background-color: #666;
        }
        .fade-enter-active,
        .fade-leave-active{
            transition: all 1s;
            
        }


    </style>
</head>
<body>
<div id="app">
    <button @click="show =  !show" >变化</button>
    <transition name="fade">
    <div class="box" v-if="show"></div>
    </transition>
    
</div>
<script>
let app = new Vue({
    el: '#app',
    data: {
        show:true
    }
});
</script>
</body>
</html>